var express = require('express');
var router = express.Router();
var path=require('path');
var connectDB = require('../connectDB');
/* GET home page. */
router.get('/', function(req, res, next) {
    let pathUrl=path.join(__dirname+'.\/../../views/lxcshangjiabupeisong.html');
    res.sendFile(pathUrl);

});

router.post('/biao',async function (req, res, next) {
    console.log(req.body.past);
    
    var lxc = await fun1(req.body.past);
    res.send(lxc);
    

});


function fun1(data) {
    return new Promise((a, b) => {
        connectDB.query('SELECT * FROM address  WHERE user_id = ?',[data],(error, results, fields) => {
            if (!error) {
                a(JSON.stringify(results));
            }
        })
    })
}
module.exports = router;






















module.exports = router;